﻿@model IEnumerable<IkoulaACDF.Models.EditUserViewModel>
@using Microsoft.AspNet.Identity

@section scripts
{
@Scripts.Render("~/bundles/tablesorter")


    @*http://mottie.github.io/tablesorter/docs/example-widget-filter.html*@
    <script type="text/javascript">

        var sorting = [[0, 0], [1, 0]];

        // note: the square brackets around sorting are required!
        $("table").trigger("sorton", [sorting]);
        $("table#sortTableExample").tablesorter(
            {
                widthFixed: true,
                showProcessing: true,
                headers: {
                    6: { sorter: false, filter: false },    // sort second column numerically

                    9: { sorter: false, filter: false },      // disable first column
                },
                widgets: ["filter"],
                widgetOptions: {
                    // css class applied to the table row containing the filters & the inputs within that row
                    filter_cssFilter: 'tablesorter-filter',

                    // filter widget: If there are child rows in the table (rows with class name from "cssChildRow" option)
                    // and this option is true and a match is found anywhere in the child row, then it will make that row
                    // visible; default is false
                    filter_childRows: false,

                    // Set this option to true to use the filter to find text from the start of the column
                    // So typing in "a" will find "albert" but not "frank", both have a's; default is false
                    filter_startsWith: false,
                },

            });
    </script>
}


@{
    ViewBag.Title = "Index";
}

<h2>Liste des membres <span class="badge">@ViewBag.CountMembers</span></h2>

<p>
    @Html.ActionLink("Create New", "Register")
</p>
<div class="table-responsive">

    <table id="sortTableExample" class="table table-striped table-bordered table-hover table-condensed tablesorter">
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.ConfirmedEmail)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.RegistrationDate)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.UserName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.FirstName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.LastName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Email)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.BirthDate)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.FirstYearSchool)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.LastYearSchool)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.LastClass)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ActualCity)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ActualCountry)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Photo)
            </th>
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.ConfirmedEmail)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.RegistrationDate)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.UserName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.FirstName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.LastName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Email)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.BirthDate)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.FirstYearSchool)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.LastYearSchool)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.LastClass)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ActualCity)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ActualCountry)
                </td>
                <td>
                    <img class="img-rounded" src="@item.PhotoUrl" alt="@item.UserName" title="@(item.FirstName + ' ' + item.LastName)" />
                </td>

                <td>
                    <div class="btn-group">
                        @Html.ActionLink("Edit", "Edit", new { id = item.UserName }, new { type = "button", @class = "btn btn-xs btn-primary" })
                        @Html.ActionLink("Roles", "UserRoles", new { id = item.UserName }, new { type = "button", @class = "btn btn-xs" })
                        @Html.ActionLink("Delete", "Delete", new { id = item.UserName }, new { type = "button", @class = "btn btn-xs btn-danger" })
                    </div>
                </td>
            </tr>
        }

    </table>
</div>